<?php
if (!isset($common)) require_once '../common.php';

		require_once 'include/functions.php';
		require_once 'include/edificios.php';
		
		$box = (4*$_SESSION['i']) + $_SESSION['j'];
		$time = GetCoste($_GET['type'], $_SESSION['level']);
		
		$coste=array($_GET['grano'], $_GET['hierro'], $_GET['oro'], $_GET['madera']);
		
		discountResources($_SESSION['idcity'][0], $coste);
		buildBuilding($box, $_GET['type'], 0, $_SESSION['idcity'][0]);
		createBuilding($_SESSION['idcity'][0], $box, $_GET['type'], $_SESSION['level'], $time[0]);

		header("Location: ../../city.php");
?>